<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/templates/common/taglib.jsp"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Access-Control-Allow-Origin" content="*">
<title>${title}</title>
<%@include file="/WEB-INF/templates/common/common.jsp"%>
<script type="text/javascript" src="${basePath}/static/page/js/jqPaginator.js"></script>
<script type="text/javascript" src="${basePath}/static/My97DatePicker/WdatePicker.js"></script>
<script  type="text/javascript" src="${basePath}/static/js/util.js"></script>

<script type="text/javascript" src="${basePath}/static/layer/layer.js"></script>
<link href="${basePath}/static/layer/layer_style.css" rel="stylesheet"
	type="text/css">
<!-- <script  type="text/javascript" src="${basePath}/static/print/js/photo.js"></script> -->
<script type="text/javascript" src="${basePath}/static/js/ajaxfileupload.js"></script>
</head>
<body>

</head>
<body>
 <!--头部-->
 <%@include file="/WEB-INF/templates/common/header.jsp"%>

<!------导航条-->
 <%@include file="/WEB-INF/templates/common/navigation.jsp"%>

<div class="list_main lay_out">
 <div class="list_DH">
    <!--打印模块导航栏-->
 <%@include file="/WEB-INF/templates/common/printnav.jsp"%>
 </div>
 <div class="list_NR">
  <div class="loc">
   <h3>邮寄登记</h3>
  </div>
 
  <div class="list_con_table"> 
   <div class="search_table">
    <ul id="table_ul">
    <input type="hidden" value="${basePath}" id="basePath"/>
    <input type="hidden" value="${picHostPath}" id="picHostPath"/>
   <form id="addmail" >
    <li class="Label_1" >姓名：&nbsp;</li>
    <li class="Label_2"><input class="input_box" type="text"  id="name"/></li>
   <li class="Label_1">ID号：</li>
    <li class="Label_2"> 
    	<input class="input_box" type="text" id="mrId" maxlength="60"/>
     </li>
     
      <li class="Label_1" >病案号：</li>
    <li class="Label_2"><input class="input_box" type="text" id="onlyId"/></li>
    
    <li class="Label_1" >住院次数：</li>
    <li class="Label_2"><input class="input_box" type="text" id="visitNumber"/></li>
    
    
    <li class="Label_1" >打印份数：</li>
    <li class="Label_2"><input type="text" id="printCopies" class="input_box" value="1"/></li>
					
    <li class="Label_1" >邮费(元)：</li>
	 <li class="Label_2"><input type="text" id="postage" class="input_box" /></li>
	 
	<li class="Label_1">出院日期：</li>
   	<li class="Label_2">
		<input class="input_box" type="text"  id='recordDate' onFocus="WdatePicker()"/>
	</li>
	<li class="Label_1">光盘刻录：</li>
   	<li class="Label_2">
		<input type="radio" name="burnCdStatus" value="1">是 &nbsp;
		<input type="radio" name="burnCdStatus" value="0">否
	</li>
	
    <li class="Label_5">
	   <a onclick="addMailRecord()" style="width:auto;">保存邮寄登记信息</a>
    </li>
    </form>
    </ul>
  </div>
 </div>
</div>
</div>
<input type="hidden" value="${firstGuid}">
<!--页脚部分-->
<%@include file="/WEB-INF/templates/common/footer.jsp"%>
 <script>
 var r = /^\+?[1-9][0-9]*$/;　
 var f = /^(([0-9]+\\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\\.[0-9]+)|([0-9]*[1-9][0-9]*))$/;　　
 
  function addMailRecord(){
	  var name = $("#name").val();
	  var mrId = $("#mrId").val();
	  var onlyId = $("#onlyId").val();
	  var visitNumber = $("#visitNumber").val(); 
	  var printCopies = $("#printCopies").val();
	  var postage = $("#postage").val();
	  var recordDate = $("#recordDate").val();
	  var burnCdStatus = $("input[name='burnCdStatus']:checked").val();
	  
	   if (mrId == null || mrId == '') {
		   layer.alert("ID号不能为空!",{icon: 5});
		   return;
	   }	  
	   if(visitNumber == null || visitNumber == '') {
		   layer.alert("住院次数不能为空!",{icon: 5});
		   return;
	   }
	   if (!r.test(visitNumber)) {
		   layer.alert("住院次数只能为整数!",{icon: 5});
		   return;
	   }
	   if (!r.test(printCopies)) {
		   layer.alert("打印份数只能为整数!",{icon: 5});
		   return;
	   }
	   if(recordDate == null || recordDate == '') {
		   layer.alert("登记日期不能为空!",{icon: 5});
		   return;
	   }
	   if (burnCdStatus == null || burnCdStatus == '') {
		   layer.alert("请选择光盘刻录!",{icon: 5});
		   return;
	   }
	   
	   var formData = {patientName:name,mrId:mrId,onlyId:onlyId,visitNumber:visitNumber,printCopies:printCopies,
			   postage:postage,recordDate:recordDate,burnCdStatus:burnCdStatus};
	  
	  $.ajax({
		  type:"post",
		  url:"${basePath}/mail/insertRegisterMail",
		  data:formData,
		  success:function(result){
			  //console.log(result);
			  if(result.success){
				  layer.alert(result.msg, {icon: 1});
				  $("#addmail")[0].reset();
			  }else{
				  layer.alert(result.msg, {icon: 5}); 
			  }
		  }
	  })
	  
  }
 </script>

</body>
</html>










